@isTest
public class MarketingExpensesControllerTest
{
    static testMethod void MarketingExpensesControllerTest()
    {
        //创建市场活动
        Campaign c = new Campaign();
        c.Name = '测试市场活动';
        c.Status = '预算审批中';
        insert c ;
        //创建市场活动费用
        MarketingExpenses__c me = new MarketingExpenses__c();
        me.MarketingActivity__c = c.Id;
        me.Item__c = '参会费';
        me.Budget__c = 1;
        me.Cost__c = 1;
        insert me;
        //页面测试
 // ---------------------新建-----------------------
        PageReference page = new PageReference('/apex/MarketingExpensesCreate?cpId=' + c.Id);
        System.Test.setCurrentPage(page);
        MarketingExpensesController mec=new MarketingExpensesController(new ApexPages.StandardController(me));
        mec.init();
        
        mec.strjson = '[{"item":"展位费","budget":"1111","cost":"111","remark":"ss"}]';
        mec.deleteId= me.Id;
        mec.save();
        System.assertEquals(1,[select Id from MarketingExpenses__c where MarketingActivity__c =:c.Id].size());
        mec.cancel();

        
    }
}